package com.road.vast.component;

import com.road.vast.utils.JwtUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @Author 郭泽鹏
 * @Date 2020/7/26 13:59
 * @Version 1.0
 * @Description JwtToken配置类
 */
@Component
@ConfigurationProperties(prefix = "jwt.config")
@PropertySource("classpath:application.yml")
public class JwtTokenComponent {
    //签名私钥
    @Value("${key}")
    private String key;
    //失效时间
    @Value("${ttl}")
    private Long ttl;

    @Bean
    public JwtUtils getJwtUtils(){
        return new JwtUtils(key, ttl);
    }
}
